package jTree;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.tree.DefaultMutableTreeNode;

public class JTree extends JFrame {

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					JTree frame = new JTree();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public JTree() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JPanel pnlEstructura = new JPanel();
		pnlEstructura.setBounds(10, 0, 196, 251);
		contentPane.add(pnlEstructura);
		
//		javax.swing.JTree arbre = new javax.swing.JTree();
//		pnlEstructura.add(arbre);
		/*******************************************************************/
		DefaultMutableTreeNode arrel = new DefaultMutableTreeNode("Imatges");
		/*******************************************************************/
		DefaultMutableTreeNode categoria1 = new DefaultMutableTreeNode("Vaixells");
		
		
		/*******************************************************************/
		DefaultMutableTreeNode categoria2 = new DefaultMutableTreeNode("Cotxes");
		DefaultMutableTreeNode categoria3 = new DefaultMutableTreeNode("Motos");
		
		arrel.add(categoria1);
		arrel.add(categoria2);
		arrel.add(categoria3);
		//JTree arbre = new JTree (arrel);
		DefaultMutableTreeNode pnlEstructura = new DefaultMutableTreeNode("Imatges");
		JPanel pnlImatge = new JPanel();
		pnlImatge.setBounds(206, 0, 218, 251);
		contentPane.add(pnlImatge);
	}
}
